package com.geostar.constructionland.index.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.geostar.constructionland.index.entity.IndexSupplementEntity;
import com.geostar.constructionland.index.entity.vo.IndexSupplementListData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface IndexSupplementMapper extends BaseMapper<IndexSupplementEntity> {
    @Select("select zbrk.rkid as inxStorageId, zbrk.xzqhdm as distCode, zbrk.xzqhmc as distName, zbrk.zbnf as indexYear, zbrk.zbmc as indexName, zbrk.zblx as indexType, dict.dictname as indexTypeName, zbrk.ywlx as businessType, zbrk.xzjsyd as buildLandAdd, zbrk.nyd as agclLand, zbrk.gd as farmland, zbrk.rksj as storageTime, zbrk.zbzt as indexStatus, zbrk.czrid as operatorId, zbrk.bz as remark, zbrk.shengxrq as effectiveTime, zbrk.shixrq as nonEffectiveTime, zbrk.xzqhdm_province as distCodeProvince, zbrk.xzqhdm_city as distCodeCity, zbrk.xzqhdm_country as distCodeCountry, zbrk.zxlx as specialItemType, zbrk.tclx as overallType, zbrk.tczt as overallStatus, " +
            "       zbtz.zbid as adjustIndexId, zbtz.xmmc as projectName, zbtz.pzwh as approvalNum, zbtz.pzrq as approvalTime, zbtz.pzjg as approvalAuthority, zbtz.xmzmj as totalProjectArea, zbtz.ywid as businessId" +
            "  from jsyd_zbrktz zbrk" +
            "  left join jsyd_zbtzqk zbtz" +
            "    on zbrk.rkid = zbtz.rkid" +
            "  left join jsyd_dic_entry dict" +
            "    on zbrk.zblx = dict.dictid" +
            "   and dict.dicttypeid = 'ZBLX'" +
            "   and dict.cj = 1"+
            " ${ew.customSqlSegment}")
    Page<IndexSupplementListData> queryIndexSupplementListByWrapper(Page page, @Param(Constants.WRAPPER) Wrapper<IndexSupplementListData> queryWrapper);
}
